"""
    时间工具类
   @author TinaRoot
   @since 2022/3/4 下午4:22
"""
import datetime


def restOfDay(type=None):
    """
    截止到目前当日剩余时间
    :param type: [0小时，1毫秒,2分钟,默认秒]
    :return:
    """
    today = datetime.datetime.strptime(str(datetime.date.today()), "%Y-%m-%d")
    tomorrow = today + datetime.timedelta(days=1)
    nowTime = datetime.datetime.now()
    if 0 == type:
        # 获取小时
        return ((tomorrow - nowTime).seconds / 60 / 60)
    elif 1 == type:
        # 获取毫秒值
        return (tomorrow - nowTime).microseconds
    elif 2 == type:
        # 获取分钟
        return (tomorrow - nowTime).seconds / 60
    else:
        # 获取秒
        return (tomorrow - nowTime).seconds



